﻿<UserControl x:Class="GSF.TimeSeries.Transport.UI.UserControls.SelectMeasurementUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" d:DesignHeight="375" d:DesignWidth="425"
             xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:uc="clr-namespace:GSF.TimeSeries.UI.UserControls;assembly=GSF.TimeSeries.UI.WPF"
             xmlns:tsfBinding="clr-namespace:GSF.TimeSeries.UI.Binding;assembly=GSF.TimeSeries.UI"
             Background="Transparent">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/GSF.TimeSeries.UI.WPF;Component/Resources/CommonResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    
    <StackPanel Orientation="Vertical">

        <TextBlock Text="Available Measurements" FontWeight="Bold" TextAlignment="Left" HorizontalAlignment="Left"/>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
            <CheckBox x:Name="CheckboxDisplayInternal" Content="Display Internal" Width="135" Checked="CheckboxDisplayInternal_Checked" Unchecked="CheckboxDisplayInternal_Unchecked"/>
            <TextBox x:Name="TextBoxSearch" Width="125"/>
            <Button Content="Search" Command="{Binding Path=SearchCommand}" CommandParameter="{Binding ElementName=TextBoxSearch, Path=Text}" ToolTip="Search measurements" Margin="2" IsDefault="True" /> 
            <Button Content="Show All" Command="{Binding Path=ShowAllCommand}" ToolTip="Show all measurements" Margin="2"/>
        </StackPanel>

        <sdk:DataGrid ItemsSource="{Binding CurrentPage}" Height="Auto" Sorting="DataGrid_Sorting">
            <sdk:DataGrid.Columns>
                <sdk:DataGridTemplateColumn Width="*">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{tsfBinding:Column Path=Selected}" HorizontalAlignment="Center" Margin="0" />
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                    <sdk:DataGridTemplateColumn.HeaderTemplate>
                        <DataTemplate>
                            <CheckBox Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.HeaderTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridTemplateColumn Header="Point Tag" Width="3*" IsReadOnly="True">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=PointTag}" ToolTip="{Binding Description}" HorizontalAlignment="Left"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
                <sdk:DataGridTemplateColumn Header="Signal Reference" Width="2*" IsReadOnly="True">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Path=ID}" ToolTip="{Binding Description}" HorizontalAlignment="Left"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
            </sdk:DataGrid.Columns>
        </sdk:DataGrid>

        <uc:DataPagerUserControl CurrentPageNumber="{Binding CurrentPageNumber}" PageCount="{Binding PageCount}"
                                 FirstCommand="{Binding FirstCommand}" PreviousCommand="{Binding PreviousCommand}"
                                 NextCommand="{Binding NextCommand}" LastCommand="{Binding LastCommand}"/>
    </StackPanel>

</UserControl>
